package com.example.project.projectspringcloud.service.impl.discountcoupon;

import com.example.project.projectspringcloud.dao.discountcoupon.DiscountCouponMapper;
import com.example.project.projectspringcloud.entity.Page;
import com.example.project.projectspringcloud.entity.discountcoupon.DiscountCoupon;
import com.example.project.projectspringcloud.service.BaseService;
import com.example.project.projectspringcloud.service.discountcoupon.DiscountCouponService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 优惠券Service
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class DiscountCouponServiceImpl extends BaseService<DiscountCoupon, DiscountCouponMapper> implements DiscountCouponService {

    @Override
    public DiscountCoupon get(DiscountCoupon discountCoupon) {
        return super.mapper.selectOne(discountCoupon);
    }

    @Override
    public List<DiscountCoupon> list(Page page, DiscountCoupon discountCoupon) {
        return super.list(page, discountCoupon);
    }

    @Override
    public boolean save(DiscountCoupon discountCoupon) {
        return super.save(discountCoupon);
    }

    @Override
    public boolean delete(Integer[] ids) {
        return super.mapper.deleteByArrayPrimaryKey(ids) > 0;
    }

    @Override
    public List<DiscountCoupon> expira(DiscountCoupon discountCoupon) {
        return super.mapper.expira(discountCoupon);
    }

    @Override
    public boolean status(Integer id, Integer status) {
        return super.mapper.status(id, status) > 0;
    }
}
